package com.gnerv.rabbitmq.agent.autoconfigure;

import com.gnerv.rabbitmq.agent.model.entity.Node;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;


/**
 * @author Gnerv LiGen
 */
@Data
@ConfigurationProperties(prefix = "rabbitmq")
public class RabbitmqAgentConfigProperties {

    private String ip;
    private List<NodeConfig> nodes;

    @Data
    public static class NodeConfig {
        private String name;
        private String path;
        private String config;
        private String ip;
        private int port;

        public Node toNode() {
            Node node = new Node();
            BeanUtils.copyProperties(this, node);
            return node;
        }

    }

}
